<template>
  <div id="ma">
    <el-table
      :data="dataList"
      style="width: 100%"
      :row-class-name="tableRowClassName"
    >
      <el-table-column prop="id" label="ID" width="290"> </el-table-column>
      <el-table-column prop="name" label="姓名" width="70"> </el-table-column>
      <el-table-column prop="account" label="账号" width="100"> </el-table-column>
      <el-table-column prop="birthday" label="生日"  width="100"> </el-table-column>
      <el-table-column prop="phone" label="电话"  width="120"> </el-table-column>
      <el-table-column prop="job" label="工作"  width="80"> </el-table-column>
      <el-table-column prop="sex" label="性别"  width="50"> </el-table-column>
      <el-table-column prop="createTime" label="创建时间"  width="100"> </el-table-column>
      <el-table-column prop="updateTime" label="修改时间"  width="100"> </el-table-column>
      <el-table-column prop="updateUser" label="修改人"  width="290"> </el-table-column>
      <el-table-column label="操作" width="80">
        <el-button type="primary">修改</el-button>
      </el-table-column>
      <el-table-column width="80">
        <el-button style="disply:inline-block" type="danger">删除</el-button>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
export default {
  name: "TzxMain",
  data() {
    return {
      dataList: [],
    };
  },
  methods: {
      tableRowClassName({row, rowIndex}) {
        if (rowIndex === 1) {
          return 'warning-row';
        } else if (rowIndex === 3) {
          return 'success-row';
        }
        return '';
      }
  },
  mounted() {
    var _this=this;
    this.axios.get("http://127.0.0.1:8080/user").then((data)=>{
                        console.log(data);
                        _this.dataList=data.data;
                    });
    console.log("axios:"+this.axios);
  },
};
</script>
<style>
#ma {
  position: absolute;
  top: 50px;
  left: 10.5%;
  width: 88.5%;
  height: 100%;
  /* background-color: rgb(0, 255, 106); */
  /* margin-top: 10px; */
  margin-left: 5px;
}

.el-table .warning-row {
    background: oldlace;
  }

  .el-table .success-row {
    background: #f0f9eb;
  }
</style>